#pragma once
#include<iostream>
using namespace std;

class Task
{
public:
  Task(int x = 0,int y = 0,char op = '+')
    :_x(x),_y(y),_op(op)
  {}
  ~Task(){}
  int Run()
  {
    int result = 0;
    switch(_op)
    {
      case '+':
        result = _x + _y;
        break;
      case '-':
        result = _x - _y;
        break;
      case '*':
        result = _x * _y;
        break;
      case '/':
        if(_y == 0)
        {
          cout <<"Warning: div zero!" << endl;
          result = -1;
        }
        else 
          result = _x / _y;
      case '%':
        if(_y == 0)
        {
          cout <<"Warning: mod zero!" << endl;
          result = -1;
        }
        else 
          result = _x % _y;
        break;
      default:
        cout << "error operation!" <<endl;
        break;
    }
    cout << _x <<" "<< _op <<" "<<_y <<" = "<<result << endl;
    return result;
  }
private:
  int _x;
  int _y;
  char _op;
};
